/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gestion;

import com.mysql.jdbc.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import negocio.*;
import operacionesDB.AbstractDB;

/**
 *
 * @author David
 */
public class DBGestionReserva extends AbstractDB {
    
    PreparedStatement ps;
    ResultSet rs;
    
    public void crearReserva(int isb, int us) {
        int i = 0;
        try {
            ps = (PreparedStatement) con.prepareStatement("call nuevaReserva(?,?)");
            ps.setInt(1, us);
            ps.setInt(2, isb);
            rs = ps.executeQuery();
            //i = ps.executeUpdate();
            System.out.println(i);
        } catch (SQLException ex) {
            Logger.getLogger(DBGestionReserva.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public void eliminarReserva(int isb, int us) {
        try {
            ps = (PreparedStatement) con.prepareStatement("call eliminarReserva (?,?)");
            ps.setInt(1, us);
            ps.setInt(2, isb);
            rs = ps.executeQuery();
        } catch (SQLException ex) {
            Logger.getLogger(DBGestionReserva.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
    
    public ResultSet bReserva(int isb) {
        rs = null;
        ps = null;
        try {
            ps = (PreparedStatement) con.prepareStatement("call buscarReserva(?)");
            ps.setInt(1, isb);
            rs = ps.executeQuery();
        } catch (SQLException ex) {
            Logger.getLogger(DBGestionReserva.class.getName()).log(Level.SEVERE, null, ex);
        }
        return rs;
    }
}
